package ddd7;

import java.util.HashMap;
import java.util.Scanner;

public class SameCharacter {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String source = sc.nextLine();
        String target = sc.nextLine();
        HashMap<Character, Integer> map = new HashMap<Character, Integer>();
        for(Character c : source.toCharArray()){
            map.put(c,map.getOrDefault(c,0)+1);
        }
        for(Character c : target.toCharArray()){
            if(!map.containsKey(c) || map.get(c)==0){
                System.out.print("NO");
                return;
            }
            map.put(c,map.get(c)-1);
        }
        int all = 0;
        for(Integer c : map.values()){
            all += c;
        }
        System.out.println("yes "+all);
    }

}

